function addLargeNumbers(num1, num2) {
  let i = num1.length - 1;
  let j = num2.length - 1;
  let carry = 0;
  let result = '';

  while (i >= 0 || j >= 0 || carry > 0) {
    let sum = carry;
    if (i >= 0) {
      sum += parseInt(num1[i]);
      i--;
    }
    if (j >= 0) {
      sum += parseInt(num2[j]);
      j--;
    }
    result = (sum % 10) + result;
    carry = Math.floor(sum / 10);
  }

  return result;
}

// 示例使用
const num1 = '12345678901234567890';
const num2 = '98765432109876543210';
console.log(addLargeNumbers(num1, num2));